include ../etc/Makefile.conf

MLS = $(filter-out lazy_%,$(wildcard *.ml))
LAZY_MLS = $(foreach x, $(MLS), lazy_$(x))
TARGS = $(MLS:.ml=)
WFLAGS = -w Ae -warn-error A
FLAGS = $(WFLAGS) -I $(LIB) lazy-ocaml.cma

all: check-project $(LAZY_MLS) $(TARGS)

tests: clean all
	for f in $(TARGS); do echo; echo ./$$f; ./$$f; done

check-project:
	$(MAKE) --no-print-directory -C ..

#lazy_test.ml: test.ml
#	$(BIN)/lazy-ocaml -no-type-check $<

lazy_%.ml: %.ml
	$(BIN)/lazy-ocaml $(WFLAGS) $<

%: lazy_%.ml
	$(OCAMLC) $(FLAGS) $< -o $@

clean:
	@/bin/rm -f *~ *.cmi *.cmo $(LAZY_MLS) $(TARGS)

.PHONY: all tests clean
